<?php

namespace App\Console\Commands;

use App\Console\Commands\Common\CommonCommand;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;

class ClearZip extends CommonCommand {

    protected $signature = 'clearzip';

    public function __construct() {
        parent::__construct();
        //Log::info('clearzip__construct');
    }

    public function handle() {
        //Log::info('ClearZip running...');
        $zipDir = public_path('/fileZip');

        $zips = scandir($zipDir);
        unset($zips[0]);
        unset($zips[1]);

        foreach ($zips as $zip) {
            unlink(public_path('/fileZip/').$zip);
        }
        //Log::info('ClearZip end');
        return 0;
    }
}
